/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoopp.framework;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;
import android.preference.PreferenceManager;
import java.io.File;

public final class g extends Thread {
    a a = null;
    String b = null;
    Throwable c = null;
    Context d;
    private int i = 1;
    public final String e = "DIRTY_FLAG";
    public final String f = "handleThread";
    public final int g = 300;
    private boolean j = true;
    private boolean k = true;
    private boolean l = true;
    private boolean m = true;

    public g(f paramf, Context paramContext, String paramString) {
        this.d = paramContext;
        this.b = paramString;
        this.a = new a(this.d);
    }

    public final void run() {
        g localg1 = this;
        int i1 = 0;
        boolean bool = false;
        int i2;
        synchronized (f.a()) {
            if (localg1.a == null) {
                LogUtil.w("handleThread", "process, elog == null");
                return;
            }
            if ((localg1.b != null) && (localg1.b != "") && (localg1.j))
                localg1.a.a(localg1.b, f.a(localg1.h));
            if ((localg1.c != null) && (localg1.j))
                localg1.a.a(localg1.c, f.a(localg1.h));
            if (localg1.k) {
                g localg2 = localg1;
                Object localObject3 = a.b;
                LogUtil.w("handleThread", "checkHasFiles, path is : " + ((String) localObject3));
                File localFile;
                if (!((localFile = new File((String) localObject3)).exists()))
                    ;
                if ((localObject3 = localFile.listFiles()) == null)
                    ;
                if (localObject3.length == 0)
                    ;
                for (int i3 = 0; i3 < localObject3.length; ++i3)
                    LogUtil.w("handleThread", "checkHasFiles, file" + i3 + " ' name is : " + localObject3[i3].getName());
                LogUtil.w("handleThread", "checkHasFiles, dir has files.");
                if (((LogUtil.w("handleThread", "checkHasFiles, dir has not file.")) ? 0 : (LogUtil.w("handleThread",
                        "checkHasFiles, path is not dir.")) ? 0 : (LogUtil.w("handleThread",
                        "checkHasFiles, dir not exist.")) ? 0 : 1) != 0) {
                    if (((ConnectivityManager) localg2.d.getSystemService("connectivity")).getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTED)
                        i3 = 1;
                    else
                        i3 = 0;
                    if (i3 != 0)
                        ;
                    localObject3 = localg2;
                    i3 = 0;
                    if (((g) localObject3).a != null)
                        i3 = ((g) localObject3).a.b();
                    if (i3 > 300)
                        i2 = 1;
                    else
                        i2 = 0;
                    if (i2 == 0)
                        ;
                }
                i2 = (LogUtil.w("handleThread", "needSendFile, timeout need.")) ? 1 : (LogUtil.w("handleThread",
                        "needSendFile, wifi need.")) ? 1 : 0;
            }
            if (i2 != 0) {
                localg1.a.a();
                long l1 = System.currentTimeMillis();
                a.d = a.c + l1;
            }
        }
        synchronized (f.b()) {
            if ((i2 != 0) && (localObject1.l)) {
                while ((localObject1.i > 0) && (!((bool = localObject1.a.a(f.a(localObject1.h))))))
                    localObject1.i -= 1;
                SharedPreferences.Editor localEditor = PreferenceManager.getDefaultSharedPreferences(localObject1.d)
                        .edit();
                String str = Long.toString(System.currentTimeMillis() / 1000L);
                localEditor.putString("SEND_TIME", str);
                localEditor.commit();
            }
            else {
                LogUtil.w("handleThread", "process, not needSend.");
                return;
            }
            if ((bool) && (localObject1.m))
                localObject1.a.c();
            else
                LogUtil.w("handleThread", "process, can not delete.");
            return;
        }
    }
}